function test_for_func(wave,fs,f)  % f is update freq, 
    
    step = fs/f;
    a = animatedline;
    axis([0,step,-10,10]);
    for k=step+1:step:(length(wave)-step)
        tic;
        clearpoints(a);
        x = k:k+step;
        addpoints(a,0:step,wave(x));
        drawnow limitrate;
        dt = toc;
        pause(1/f-dt);
    end

end